home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
libs
/
jpeglibrary50.lha
/
jpeglibrary
/
includes
/
jpeg
/
jpeg.h
< prev
Wrap
C/C++ Source or Header
|
1999-01-30
|
8KB
|
197 lines
#ifndef JPEG_H
#define JPEG_H
/*
** $VER: jpeg.h 5.0 (30.1.99)
**
** Public structures and defintions for jpeg.library.
**
** © Paul Huxham
**
** This software is based in part on the work of
** the Independent JPEG Group.
*/
#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif
#ifndef DOS_DOS_H
#include <dos/dos.h>
#endif
#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif
/*========================================================================*/
/* Public object handles */
/* Used for JPEG decompression */
struct JPEGDecHandle
{
ULONG ptr; // Private!
};
/* Used for JPEG compression */
struct JPEGComHandle
{
ULONG ptr; // Private!
};
/*========================================================================*/
/* Public callback hooks */
/* The decompress hook is called once for each scanline in the image.
a0 contains a UBYTE pointer to the scanline to copy
d0 contains a ULONG with the scanline number of this data (1 being
first scanline)
d1 contains a ULONG with the number of bytes in this row
a1 contains the userdata
If the hook returns a non NULL value, the decoding will be aborted -
You should NOT call any functions other than FreeJPEGDecompress() on
that jpeg object.
*/
typedef ULONG (*JPGD_HOOK)( void *, ULONG, ULONG, void * );
typedef __asm ULONG (*JPGD_HOOK_PROTO)( register __a0 void *, register __d0 ULONG, register __d1 ULONG, register __a1 void * );
/* The compress hook is called once for each scanline in the image.
a0 contains a UBYTE **. Copy into here (*ptr=) the pointer to the image
d0 contains a ULONG with the scanline number of the scanline I want
d1 contains a ULONG with the width of the image
a1 contains the userdata
If the hook returns a non NULL value, the encoding will be aborted -
You should NOT call any functions other than FreeJPEGCompress() on
that jpeg object.
*/
typedef ULONG (*JPGC_HOOK)( UBYTE **, ULONG, ULONG, void * );
typedef __asm ULONG (*JPGC_HOOK_PROTO)( register __a0 UBYTE **, register __d0 ULONG, register __d1 ULONG, register __a1 void * );
/* The progress hook is called once for each scanline in the image (during
compression and decompression).
d0 contains a ULONG with the current scanline number (1-n).
d1 contains a ULONG with the total number of scanlines.
a0 contains the userdata
If the hook returns a non NULL value, the encoding will be aborted -
You should NOT call any functions other than FreeJPEGCompress() on
that jpeg object.
*/
typedef ULONG (*JPGP_HOOK)( ULONG, ULONG, void * );
typedef __asm ULONG (*JPGP_HOOK_PROTO)( register __d0 ULONG, register __d1 ULONG, register __a0 void * );
/* The render hook is called once for each decompressed scanline in the
image.
a0 contains a UBYTE pointer to the scanline data
d0 contains a ULONG with the scanline number of this data (1 being
first scanline)
d1 contains a ULONG with the number of bytes in this row
a1 contains the userdata
If the hook returns a non NULL value, the decoding will be aborted -
You should NOT call any functions other than FreeJPEGDecompress() on
that jpeg object.
*/
typedef ULONG (*JPGR_HOOK)( void *, ULONG, ULONG, void * );
typedef __asm ULONG (*JPGR_HOOK_PROTO)( register __a0 void *, register __d0 ULONG, register __d1 ULONG, register __a1 void * );
/*========================================================================*/
/* JFIF encoder/decoder processing arithmetic */
enum
{
DCT_ISLOW, // Slow but accurate integer algorithm (default)
DCT_IFAST, // Faster, less accurate integer method
DCT_FLOAT // Floating-point: accurate, fast on fast hardware
};
/*========================================================================*/
/* Colour space defines, from JPG_ColourSpace */
enum
{
JPCS_UNKNOWN, // Error/unspecified
JPCS_GRAYSCALE, // Monochrome
JPCS_RGB, // Red/green/blue
JPCS_YCbCr, // Y/Cb/Cr (also known as YUV)
JPCS_CMYK, // C/M/Y/K
JPCS_YCCK // Y/Cb/Cr/K
};
/*========================================================================*/
/* Jpeg tagbase */
#define JPG_TB ( TAG_USER + 0x80000 )
/* Jpeg tags requiring V1.0 */
#define JPG_SrcMemStream JPG_TB + 1 /* Pointer to stream data in memory (UBYTE *) */
#define JPG_SrcMemStreamSize JPG_TB + 2 /* Length in bytes of data stream (ULONG) */
#define JPG_DestMemStream JPG_TB + 3 /* Pointer to a pointer to created data in memory (UBYTE **) */
#define JPG_DestMemStreamSize JPG_TB + 4 /* Pointer to take size of created data (ULONG *) */
#define JPG_SrcFile JPG_TB + 5 /* Pointer to an open file (BPTR) */
#define JPG_DestFile JPG_TB + 6 /* Pointer to an open file (BPTR) */
#define JPG_DestRGBBuffer JPG_TB + 7 /* Pointer to a memory block (UBYTE *) */
#define JPG_DecompressHook JPG_TB + 8 /* Pointer to a function to store scan lines */
#define JPG_DecompressUserData JPG_TB + 9 /* Pointer to user data (void *) */
#define JPG_SrcRGBBuffer JPG_TB + 12 /* Pointer to a memory block (UBYTE *) */
#define JPG_CompressHook JPG_TB + 13 /* Pointer to a function to store scan lines */
#define JPG_CompressUserData JPG_TB + 14 /* Pointer to user data (void *) */
/* Jpeg tags affecting image size and quality */
#define JPG_ScaleNum JPG_TB + 10 /* Numerator for scaling (ULONG) */
#define JPG_ScaleDenom JPG_TB + 11 /* Denomenator for scaling (ULONG) */
#define JPG_Width JPG_TB + 20 /* Width of image in pixels (ULONG *) */
#define JPG_Height JPG_TB + 21 /* Height of image in pixels (ULONG *) */
#define JPG_BytesPerPixel JPG_TB + 22 /* Number of bytes per image pixel (ULONG *) */
#define JPG_RowSize JPG_TB + 23 /* Size of one row (ULONG *) [GET only] */
#define JPG_ColourSpace JPG_TB + 24 /* Type of image data */
#define JPG_Quality JPG_TB + 25 /* Save quality of jpeg (1-100) () */
#define JPG_Smoothing JPG_TB + 26 /* Save smoothing amount (0-100) () */
/* Jpeg tags requiring V2.1 */
#define JPG_ProgressHook JPG_TB + 15 /* Pointer to a function to display progress status */
#define JPG_ProgressUserData JPG_TB + 16 /* Pointer to user data (void *) */
/* Jpeg tags requiring V3.0 */
#define JPG_MemoryPool JPG_TB + 17 /* All de/allocs are on this memory pool (void *) [U] */
#define JPG_RenderHook JPG_TB + 18 /* Pointer to a function to render decoded scan lines */
#define JPG_RenderUserData JPG_TB + 19 /* Pointer to user data (void *) */
/* Jpeg tags requiring V4.0 */
#define JPG_DCTMethod JPG_TB + 27 /* Use this DCT method [U] */
/* Jpeg tags requiring V5.0 */
#define JPG_BlockSmoothing JPG_TB + 28 /* If TRUE, apply block smoothing in the decoder (BOOL) [U] */
#define JPG_Progressive JPG_TB + 29 /* If TRUE, jpeg streams are CREATED in progressive mode (BOOL) [U] */
/*========================================================================*/
/* Defined error return codes */
#define JPGERR_NONE 0 /* No error */
#define JPGERR_NOMEMORY 1 /* Insufficient memory */
#define JPGERR_NOHANDLE 2 /* No jpeg handle supplied */
#define JPGERR_CREATEOBJECT 3 /* Failed to create JPEG object */
#define JPGERR_DECOMPFAILURE 4 /* Failed to decompress */
#define JPGERR_NOSRCSTREAM 5 /* No source stream to decode */
#define JPGERR_NODESTBUFFER 6 /* No destination rgb buffer/hook */
#define JPGERR_DECOMPABORTED 7 /* Decompression aborted by user hook */
#define JPGERR_NODESTSTREAM 8 /* No destination stream pointers */
#define JPGERR_COMPFAILURE 9 /* Failed to compress */
#define JPGERR_COMPABORTED 10 /* Compression aborted by user hook */
#define JPGERR_NOIMAGESIZE 11 /* No image size supplied */
#define JPGERR_ALREADYDECOMP 12 /* Handle has already been decompressed */
#define JPGERR_ALREADYCOMP 13 /* Handle has already been compressed */
#define JPGERR_NOTJPEG 14 /* The stream is not jpeg format */
#define JPGERR_ARITHNOTSUPP 15 /* Arithmetic encoded jpeg streams are not supported */
#define JPGERR_CORRUPTJPEG 16 /* The jpeg stream is corrupt */
/* Obsolete - do not use in new code */
#define FreeJPEGRGBBuffer FreeJPEGBuffer
#define AllocRGBFromJPEG AllocBufferFromJPEG
#define AllocRGBFromJPEGA AllocBufferFromJPEGA
#endif /* JPEG_H */